
-- Class: StackFlea

StackFlea = Animation:extend
{
	width = 48,
	height = 48,

	direction = LEFT,

	-- Property: bbox
	-- bbox is set in the constructor, it seems if we initialize it to {} then
	-- the constructor doesn't override {}


	image = 'flea-stack.png',

	sequences =
	{

		anim_left =  { frames = {1,2}, fps = 3 },
		anim_right = { frames = {3,4}, fps = 3 },
	},

	new = function (self, obj)
		obj = obj or {}
		self:extend(obj)
		if obj.onNew then obj:onNew() end
		obj:setDirection()
		return obj
	end,

	-- NOTE - need to be very careful we don't mistype self:play('...') as
	-- self.play('...').
	-- The latter will cause a "silent fail" with no animation
	--
	setDirection = function (self)
		if self.direction == LEFT then
			self:play('anim_left')
		else
			self:play('anim_right')
		end

	end,



	onCollide = function (self, other)
		self:displace(other)
	end,



}

